package com.example.boot.controller.transaction;

import com.example.boot.service.transaction.ITransactionRequiredService;
import com.example.boot.service.transaction.ITransactionRequiresNewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TransactionController {

    @Autowired
    private ITransactionRequiredService service;
    @Autowired
    private ITransactionRequiresNewService iTransactionRequiresNewService;

    @GetMapping("/testRequired1")
    public String testRequired1(){
        service.notransaction_exception_required_required();
        return "success";
    }

    @GetMapping("/testRequired2")
    public String testRequired2(){
        service.notransaction_required_required_exception();
        return "success";
    }

    @GetMapping("/testRequired3")
    public String testRequired3(){
        service.transaction_exception_required_required();
        return "success";
    }

    @GetMapping("/testRequired4")
    public String testRequired4(){
        service.transaction_required_required_exception();
        return "success";
    }

    @GetMapping("/testRequired5")
    public String testRequired5(){
        service.transaction_required_required_exception_try();
        return "success";
    }

    @GetMapping("/testRequired6")
    public String testRequired6(){
        iTransactionRequiresNewService.notransaction_exception_requiresNew_requiresNew();
        return "success";
    }

    @GetMapping("/testRequired7")
    public String testRequired7(){
        iTransactionRequiresNewService.notransaction_requiresNew_requiresNew_exception();
        return "success";
    }

    @GetMapping("/testRequired8")
    public String testRequired8(){
        iTransactionRequiresNewService.transaction_exception_required_requiresNew_requiresNew();
        return "success";
    }

    @GetMapping("/testRequired9")
    public String testRequired9(){
        iTransactionRequiresNewService.transaction_required_requiresNew_requiresNew_exception();
        return "success";
    }

    @GetMapping("/testRequired11")
    public String testRequired11(){
        iTransactionRequiresNewService.transaction_required_requiresNew_requiresNew_exception_try();
        return "success";
    }

}
